import * as PIXI from 'pixi.js';
import SketchLayer from './view/layer/SketchLayer';

export default class Canvas2D {
	app: PIXI.Application;
	width: number;
	height: number;
	data: any;
	dragging: boolean = false;
	sketch: SketchLayer;

	// point:PIXI.point;

	constructor(canvas: any, width: number, height: number) {
		this.width = width;
		this.height = height;
		this.app = new PIXI.Application({
			width: width,
			height: height,
			transparent: false,
			view: canvas,
			backgroundColor: 0xffffff
		})
		// canvas.style.touchAction = 'auto'

		this.sketch = new SketchLayer();
		this.init();
		// window.addEventListener("mousewheel", this.onScale.bind(this));
		console.log(this.sketch);
		this.sketch.interactive = true;
		// this.sketch.on("pointerdown", this.onMouseDown.bind(this));
	}

	async init(){
		this.app.stage.addChild(this.sketch);
	}
}